
<template tag="以下文档内容为hycli自动生成">
  <div>
   
    <!-- 修改部门 -->
    <el-dialog v-model="conf.aaayw_visible" 
        draggable
      title="修改部门" :close-on-click-modal="false"  width="60%"
      top="10vh" 
      :before-close="hide_aaayw">
    <el-form  ref="fm_aaayw" :model="form_aaayw" :rules="rules_aaayw">
    <el-row>
    <el-col :span="12">
    <!-- {"index":8,"raw":"dpt_id","name":"dpt_id","cname":"DptId","type":{"raw":"varchar2(32)","name":"varchar2","len":32,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","u","l","q","le","fq","sl(department_info)","tp(tree,l)","v","lw(160)","tp(cascader,c-u-w)","color","w"],"desc":{"raw":"部门","name":"部门"}} -->
     <!--部门 选择树 -->
     <el-form-item  label="部门" label-width="100px" label-position="right">
        <el-cascader ref="cascader_aaayi" style="width: 100%;"
        v-model="form_aaayw.dpt_id" 
        placeholder="请选择部门"
        collapse-tags  collapse-tags-tooltip  clearable   :options="dpt_idList"
        :props="{  children: 'children', label: 'name' }" />
    </el-form-item>
    </el-col>
    <el-col :span="12"></el-col>
    <el-col :span="24">
    <!-- {"index":9,"raw":"lob_id","name":"lob_id","cname":"LobId","type":{"raw":"varchar2(32)","name":"varchar2","len":32,"dlen":0},"defValue":"","allowNull":false,"constraints":["tp(ddmenu,q)","tp(multicheck,c-u)","c","u","l","q(#lob_id)","fq","le","sl(my_business_line)","v","lw(200)","color","w","ps(full)","DG"],"desc":{"raw":"业务线","name":"业务线"}} -->
     <!--业务线 下拉控件 -->
    <el-form-item prop="lob_id" label="业务线" label-width="100px" label-position="right">
      <el-select   v-model="form_aaayw.lob_id" style="width: 100%" filterable clearable
        placeholder="请选择业务线" >
        <el-option v-for="item in lob_idList" :key="item.value" :label="item.name" :value="item.value" />
      </el-select>
    </el-form-item>
    </el-col>
    </el-row>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="hide_aaayw" icon="close">取消</el-button>
        <el-button type="primary" @click="save_aaayw" icon="select">提交</el-button>
      </span>
    </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return{
      conf:{
        aaayw_visible:false,//修改部门
      },
      dpt_idList:[],
      dpt_id:"",
      form_aaayw:{},//修改部门
      //修改部门
      rules_aaayw:{ 
        dpt_id:[{required:false, message:"请输入部门", trigger: 'blur'}], 
        lob_id:[{required:true, message:"请输入业务线", trigger: 'blur'}],
      },
    }
  },
  methods:{
     //--------------------修改部门---------------------------------
      //显示 修改部门 弹出框
      show_aaayw(fm){
        //处理输入参数
        let currentForm = {}
        Object.assign(this.form_aaayw,currentForm)
        this.form_aaayw.dpt_id = fm.dpt_id
        this.form_aaayw.lob_id = fm.lob_id
        this.form_aaayw.staff_id = fm.staff_id
        //特殊参数处理
        // this.form_aaayw.staff_id = (this.bcheck||[]).join(",")
        this.loadEnums_aaayw()
        this.conf.aaayw_visible = true;
      },

      //隐藏 修改部门 弹出框
      hide_aaayw(){
        this.conf.aaayw_visible = false;
        this.$refs.fm_aaayw.resetFields();
      },

      //保存 修改部门 弹出框数据
      save_aaayw(){
        let that = this
        this.$refs.fm_aaayw.validate((v=>{
          if(!v) return
          let post_form_aaayw = this.form_aaayw
          let dpt_id = []
          let dpt_idNodes = this.$refs.cascader_aaayi.getCheckedNodes() || []
          dpt_idNodes.forEach(v => {
            dpt_id.push(v.value)
          })
          post_form_aaayw.dpt_id = dpt_id.join(",")
          this.$theia.http.post("/ws/staff/info/cngdpt",post_form_aaayw).then(res=>{
            that.$notify.success({title: '成功',message: '提交成功',duration:5000})
            that.$emit("onsaved")
            that.hide_aaayw()
          }).catch(res=>{
            let code = ((res||{}).response||{}).status||0
            let msg= `提交失败(${code})`
            that.$notify.error({title: '失败',message:msg,duration:5000})
          })
      }))
    },
    //修改部门
    loadEnums_aaayw(){
        //部门
        this.dpt_idList = this.$theia.enum.getTree("department_info","","" ,99)
        //业务线
        this.lob_idList = this.$theia.enum.get("my_business_line","","" ,false,"")
    },

  },
}
</script>
<style scoped>
.form_item_info{
  margin-left: 4px;
  color:#999;
}
.form_item_info:hover{
  cursor: pointer;
  font-weight: 500;
  color:#333;
}
</style>